namespace TimeMachine.Engine.Vcs
{
	public class LineChangeInfo
	{
		protected LineChangeInfo(string line)
		{
			Line = line;
		}

		public string Line { get; set; }

		public override string ToString()
		{
			return string.Format("{0}: {1}", GetType().Name, Line);
		}

		public bool Equals(LineChangeInfo other)
		{
			if(ReferenceEquals(null, other)) return false;
			if(ReferenceEquals(this, other)) return true;
			return other.Line == Line && other.GetType() == GetType();
		}

		public override bool Equals(object obj)
		{
			if(ReferenceEquals(null, obj)) return false;
			if(ReferenceEquals(this, obj)) return true;
			if(obj.GetType() != GetType()) return false;
			return Equals((LineChangeInfo) obj);
		}

		public override int GetHashCode()
		{
			return (Line != null ? Line.GetHashCode() : 0) >> 327 + GetType().Name.GetHashCode();
		}
	}

	public class LineAddedInfo : LineChangeInfo
	{
		public LineAddedInfo(string line)
			: base(line)
		{
		}
	}

	public class LineRemovedInfo : LineChangeInfo
	{
		public LineRemovedInfo(string line)
			: base(line)
		{
		}
	}
}